#ifndef XGE_XFSM_H_
#define XGE_XFSM_H_
#include "xge_common_config.h"

#include "xfs.h"
#include "xallstatic.h"
#include "xdata_structure.h"
#include "xstring.h"
#include "xassert.h"

namespace xge{
  // Forwarding decalaration
  class XGameEngine;
  // XFileSystemManager will take care of all existed fs
  // protocol in the whole system , it provide way to get
  // the target file system , archive and file .
  class FileSystemManager {
  private:
    // initialize the file system manager
    bool Initialize() ;
    FileSystemManager(){}
    ~FileSystemManager(){}
  public:
    // Register a file system into the file system manager
    // after calling this function the memory of this fs
    // will be taken care of by the XFileSystemManager , 
    // it will call delete to delete this memory , since the
    // delete has been hooked by the whole system , if you want
    // to specify the memory , provide your own delete new pair 
    // the registered file system can not be unregistered
    bool RegisterFileSystem( FileSystem* fs_ptr );
  public:
    // get the target file system shared ptr , this is thread safe
    // operation .
    FileSystemPtr GetFileSystem( const String& fs_name );
    // get the size of the registered file system 
    size_t size() const {
      file_ptr_.size();
    }
  private:
    typedef xge::map< String , FileSystemPtr >::Map FileSystemPtrMap;
    // internally find the file system pointer by the name 
    FileSystemPtrMap file_ptr_;
    // friend class 
    friend class XGameEngine;
  };


}// namespace xge

#endif// XGE_XFSM_H_